package com.dlm.service;

import com.dlm.dao.UserCoupon;
import com.jfinal.plugin.activerecord.Page;

/**
 * Created by chongsong on 15/2/1.
 * <mailto>chong.song@autonavi.com</mailto>
 * 优惠券service类
 */
public interface IUserCouponService {
    public boolean addNewUserCoupon(long phone) throws Exception;
    /**
     * 添加优惠券
     * @param coupon 优惠券对象
     * @return  成功:true  失败:falsel
     * @throws Exception
     */
    public boolean add(UserCoupon coupon) throws Exception;

    /**
     * 根据id删除优惠券
     * @param id    优惠券id
     * @return  成功:true  失败:falsel
     * @throws Exception
     */
    public boolean delete(long id) throws Exception;

    /**
     * 更新优惠券对象
     * @param evaluate 优惠券对象
     * @return  成功:true  失败:falsel
     * @throws Exception
     */
    public boolean update(UserCoupon evaluate) throws Exception;

    /**
     * 根据优惠券id查询
     * @param id    优惠券id
     * @return  返回优惠券对象
     * @throws Exception
     */
    public UserCoupon findById(long id) throws Exception;

    /**
     * 分页查询
     * @return 优惠券集合
     * @throws Exception
     */
    public Page<UserCoupon> findByPage(int pn, int ps,long tel,int isUseful) throws Exception;

    /**
     * 使用优惠券
     * @param id 优惠券id
     * @throws Exception
     */
    public void useCoupon(long id) throws Exception;

}
